//
//  UIImage+Extension.m
//  DHWeibo
//
//  Created by donghai on 15/12/14.
//  Copyright © 2015年 东海. All rights reserved.
//

#import "UIImage+Extension.h"

@implementation UIImage (Extension)

+(instancetype)imageWithName:(NSString *)imgName
{
    //如果系统大于iOS7，使用带有iOS7的图片
    if ([UIDevice currentDevice].systemVersion.doubleValue >= 7.0) {
        NSString *ios7ImgName = [imgName stringByAppendingString:@"_ios7"];
        return [UIImage imageWithName:ios7ImgName];
    }
    return [UIImage imageWithName:imgName];
}

+(instancetype)resizeImgWithName:(NSString *)imgName
{
    UIImage *img = [UIImage imageWithName:imgName];
    return [img stretchableImageWithLeftCapWidth:img.size.width * 0.5 topCapHeight:img.size.height * 0.5];
}

@end
